

#import "WebAnalyticsView.h"
#define yCord 40
#import "WebAnalyticsBrowserView.h"
@implementation WebAnalyticsView
@synthesize tblList,contentView,arrayItems;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle


// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView
{
    contentView = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
	contentView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
	self.view = contentView;

    tblList=[[UITableView alloc]initWithFrame:contentView.frame style:UITableViewStylePlain];
    tblList.dataSource=self;
    tblList.autoresizingMask= (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
    
    tblList.delegate=self;
    [contentView addSubview:tblList];
      
    arrayItems=[[NSArray alloc]initWithObjects:@"Index Page 1",@"Index Page 2",@"Bango", nil];
}
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
{
    self.navigationItem.title = @"Web analytics";
    [super viewDidLoad];
}


- (void)viewDidUnload
{

    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
#pragma mark -
#pragma mark Button handlers
-(IBAction)btn_Events:(id)sender
{
    
[self.navigationController popToRootViewControllerAnimated:YES];
    
}

#pragma mark -
#pragma mark Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    // Return the number of sections.
    return 1;
}


// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView
 numberOfRowsInSection:(NSInteger)section {
    
    
    return 3;
}


// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)myTableView 
         cellForRowAtIndexPath:(NSIndexPath *)indexPath {
	
	// Default cell identifier
	NSString *CellIdentifier = @"Cell";
    
	// Create a cell.
    UITableViewCell *cell = [myTableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
    }
    cell.textLabel.text=[arrayItems objectAtIndex:indexPath.row];


    return cell;
}
#pragma mark -
#pragma mark Table view delegate

// Override to support row selection in the table view.
- (void)tableView:(UITableView *)tableView 
didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    WebAnalyticsBrowserView *webview=[[WebAnalyticsBrowserView alloc]init];
    [self.navigationController pushViewController:webview animated:YES];
    [webview loadHTML:[arrayItems objectAtIndex:indexPath.row]];

    [webview release];
    
}
#pragma mark - Memory management


-(void)dealloc
{
    [tblList release];
    [arrayItems release];
    [contentView release];
    [super dealloc];
}
@end
